#include <dirent.h>
#include <errno.h>
#include <stdio.h>

int main()
{
	DIR *dir = NULL;
	struct dirent *dent = NULL;

	if (!(dir = opendir("."))) {
		perror("opendir");
		return 1;
	}

	errno = 0;
	dent = readdir(dir);
	while (dent) {
		printf("%lu %s\n", dent->d_ino, dent->d_name);
		errno = 0;
		dent = readdir(dir);
	}
	if (errno) {
		perror("readdir");
		return 1;
	}

	closedir(dir);
	return 0;
}
